<template>
	<view class="goods_list">
		 <view class="goods_item" v-for="(item,index) in goods" :key='index' @click="natve(index)">
			<image :src="item.image"></image>
			<view class="price">
				<text>￥{{item.price}}</text>
				<text>￥{{item.price_yuan}}</text>
			</view>
			<view class="name">
				{{item.name}}
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:['goods'],
		methods:{
			natve(index){
				this.$emit('goodsItemClick',index)
			}
		}
	}
</script>

<style lang="scss">
	.goods_list {
		padding: 0 15rpx;
		display: flex;
		flex-wrap: wrap; //换行
		justify-content: space-between; //两边对齐
	
		.goods_item {
			background-color: #FFFFFF;
			width: 355rpx;
			margin: 10rpx 0;
			padding: 15rpx;
			box-sizing: border-box; //防止盒子撑大
	
			image {
				width: 80%;
				height: 150px;
				display: block;
				margin: auto; //图片居中
			}
	
			.price {
				color: $shop-color;
				font-size: 36rpx;
				margin: 20rpx 0 5rpx 0;
	
				text:nth-child(2) {
					color: #C0C0C0;
					font-size: 28rpx;
					margin-left: 17rpx;
					text-decoration: line-through; //中间线
				}
			}
	
			.name {
				font-size: 32rpx;
				line-height: 50rpx; //行高
				padding-bottom: 15rpx; //间距
				padding-top: 10rpx;
			}
		}
	}
</style>
